#!/usr/bin/python
# -*- coding: utf-8 -*-

'''登录世纪佳缘----测试'''


import sys
import requests


url = 'http://login.jiayuan.com'
session = requests.Session()
request_headers = {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                  'Accept-Encoding':'gzip,deflate',
                  'Accept-Language':'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3',
                  'Connection':'keep-alive',
                  'Host':'login.jiayuan.com',
                  'User-Agent':'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko',
                  }
response = session.get(url, headers=request_headers)

passport_url = r'https://passport.jiayuan.com/dologin.php?pre_url=http://www.jiayuan.com/usercp'
headers = {'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
           'Accept-Encoding':'gzip,deflate',
           'Accept-Language':'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3',
           'Connection':'keep-alive',
           'Host':'passport.jiayuan.com',
           'Cache-Control': 'no-cache',
           'Content-Type': 'application/x-www-form-urlencoded',
           'Referer':'http://login.jiayuan.com/',
           'User-Agent':'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko',
           }
payload = {'name':'baixuexue123@sina.com',
           'password': 'xuebailove321',
           '_s_x_id': '232224f0b279d8e650d5b61aebd5804b',
           'm_p_l': '1',
           'ljg_login': '1',
           'position': '0',
           'channel': '0',
           'remem_pass': 'on',
           }


response = requests.post(passport_url, data=payload, headers=headers, verify=True)
print response.status_code



# if __name__ == '__main__':
#     login()










